package com.zmn.oms.third.taobao;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 类描述：
 *
 * @author LiangHailong
 * @date 2019/06/12 16:46
 */
@Component
public class TaobaoTmcConstants {

    public static final String NAME_TMALL = "天猫";
    public static final String NAME_TMALL_QG = "天猫勤鸽店（无忧购）";
    public static final String NAME_TMALL_BIZ = "天猫B端安装";
    public static final String NAME_TMALL_BIZ_OPPEIN = "天猫B端-欧派";

    public static boolean POWER_ON; // 天猫服务接入总开关（用于测试环境中关闭天猫接入）

    public static String APPKEY;
    public static String SECRET;

    public static String API_URL;
    public static String TOKEN_URL;
    public static String AUTHORIZE_CODE_URL;
    public static String REDIRECT_URL;
    public static String MESSAGE_QUEUE_URL;

    /**
     * Redis key, 使用redis过滤重复新单消息。
     *  天猫新单消息有可能在极短的时间（小于1秒）内，重复发送两次，导致录单重复
     */
    public static final int REDIS_EXPIRE_SECONDS = 5 * 60;

    /** *********** 消息主题 topic ************ **/
    public static final String TOPIC_FUWU_WORKCARD_INFO = "tmall_fuwu_WorkcardInfo";   // 天猫服务任务工单
    public static final String TOPIC_FUWU_ANOMALY_RECOURSE = "tmall_fuwu_AnomalyRecourse";   // 一键求助单创建消息队列
    public static final String TOPIC_FUWU_SERVICE_MONITOR = "tmall_fuwu_ServiceMonitorMessage";   // 服务预警单消息队列
    public static final String TMALL_FUWU_WORKCARD_STATUS_UPDATE = "tmall_fuwu_WorkcardStatusUpdate";   // 除工单创建以外的其他节点队列

    /**
     * ********** 服务类型（天猫勤鸽） ************
     **/
    public static final String ORDER_TASK_UPDATA_DUTYTIME = "reserve";//修改预约时间#reserve;挂起（确定下次上门时间）
    public static final String ORDER_TASK_SIGN_IN = "sign_in";//勤鸽工人签到成功#sign_in
    public static final String ORDER_TASK_SIGN_IN_FAILED = "sign_in_failed";//勤鸽工人签到失败#sign_in_failed
    public static final String ORDER_TASK_MASTER_TAKE = "accept";//勤鸽工人接单（啄木鸟领单）#accept
    public static final String ORDER_TASK_DISTRIBUTE_BACK = "reject"; // 勤鸽工人放弃工单（派单撤回）#reject
    public static final String ORDER_TASK_COMPLETE = "complete";//核销（工单完成）#complete
    public static final String ORDER_TASK_CANCEL = "cancel";//工单取消#cancel
    public static final String ORDER_TASK_SUSPEND = "suspend";//挂起（不确定下次上门时间）#suspend
    public static final String ORDER_TASK_RESERVE_FAILED = "reserve_failed";//预约失败
    public static final String ORDER_TASK_SOURCE = "buyer";//用户操作

    /** *********** 服务类型（天猫无忧购） ************ **/
    public static final String SERVICE_LIGHTING_INSTALL = "new_retail_lighting_install";   // 灯具安装
    public static final String SERVICE_BATHROOM_INSTALL = "new_retail_bathroom_install";   // 卫浴安装
    public static final String SERVICE_DATA_RECOVERY = "data_recovery_service";   // 数据恢复
    public static final String SERVICE_COMPUTER_INSTALL = "computer_install";   // 电脑安装
    public static final String SERVICE_APPLIANCE_CLEANING = "appliance_cleaning";   // 家电清洗
    public static final String SERVICE_AIR_CONDITIONER_CLEANING = "air_conditioner_cleaning";   // 空调清洗
    public static final String SERVICE_WATER_PURIFIER_INSTALL_REPLACE = "water_purifier_installment_replacement";   // 净水器/滤芯安装替换
    public static final String SERVICE_FORMALDEHYDE_CLEAR = "formaldehyde_clear";   // 除甲醛
    public static final String SERVICE_PHONE_MAINTAIN = "mobile_phone_maintain";   // 手机维修
    public static final String SERVICE_APPLIANCE_REPAIR = "new_retail_home_appliance_repair";   // 家电安装维修
    public static final String SERVICE_AIR_CONDITIONER_INSTALL = "new_retail_air_condition_install";   // 空调安装维修
    public static final String SERVICE_DAILY_CLEANING = "new_retail_daily_cleaning";   // 日常保洁
    /** *********** 服务类型（天猫B端安装） ************ **/
    public static final String SERVICE_SEND_AND_INSTALL = "sendAndInstall";   // 电器预约安装(消费者现场付安装费)
    public static final String SERVICE_TV_INSTALL = "tv_install";   // 电器预约安装(消费者在购买商品时在线付安装费)
    public static final String SERVICE_APPLIANCE_INSTALL = "appliance_install";   // 电器预约安装

    public static int ORDER_TASK_STATUS_NEW_ORDER = 8;  // 新单
    public static int ORDER_TASK_STATUS_ORDER_UPDATE = 9;  // 服务商改约、回传工人
    public static int ORDER_TASK_STATUS_ORDER_COMPLATE_SP = 102;  // 服务商回传工单完成
    public static int ORDER_TASK_STATUS_ORDER_CANCEL = 6;  // 服务商取消
    public static int ORDER_TASK_STATUS_ORDER_COMPLATE_CUSTOMER = 5;  // 核销完成或消费者主动确认完成

    @Value("${taobao.top.power-on:false}")
    public void setPowerOn(boolean powerOn) {
        POWER_ON = powerOn;
    }
    @Value("${taobao.top.appkey:null}")
    public void setAppkey(String appkey) {
        APPKEY = appkey;
    }
    @Value("${taobao.top.secret:null}")
    public void setSecret(String secret) {
        SECRET = secret;
    }
    @Value("${taobao.top.url.get-token:null}")
    public void setTokenUrl(String tokenUrl) {
        TOKEN_URL = tokenUrl;
    }
    @Value("${taobao.top.url.authorize-code:null}")
    public void setAuthorizeCodeUrl(String authorizeCodeUrl) {
        AUTHORIZE_CODE_URL = authorizeCodeUrl;
    }
    @Value("${taobao.top.url.zmn-callbck:null}")
    public void setRedirectUrl(String redirectUrl) {
        REDIRECT_URL = redirectUrl;
    }
    @Value("${taobao.top.url.message-queue:null}")
    public void setMessageQueueUrl(String messageQueueUrl) {
        MESSAGE_QUEUE_URL = messageQueueUrl;
    }
    @Value("${taobao.top.url.api-invok:null}")
    public void setApiUrl(String apiUrl) {
        API_URL = apiUrl;
    }
}
